package com.jiayang.business.equipmenterrorpage;

import com.jiayang.business.equipmenterrorpage.domain.dto.EquipmentErrorQueryDTO;
import com.jiayang.common.anno.OperateLog;
import com.jiayang.common.domain.ResponseDTO;
import com.jiayang.constant.SwaggerTagConst;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @ Author     ：OuyangChenglong
 * @ Date       ：Created in 9:56 2021/9/8
 * @ Description：设备故障详情页
 * @ Modified By：
 * @Version: 1.0$
 */
@RestController
@Api(tags = {SwaggerTagConst.Admin.CLIENT_EQUIPMENT_ERROR})
@OperateLog
public class EquipmentErrorController {

    @Autowired
    private EquipmentErrorService equipmentErrorService;

    // 故障详情处理页 -----------------------------------------------------------------------------------------------------
    @PostMapping("/equipmentInfo/error/getEquipmentErrorList")
    @ApiOperation(value = "获取设备的故障列表", notes = "故障列表 @author OuyangChenglong")
    public ResponseDTO getEquipmentErrorList(@Valid @RequestBody EquipmentErrorQueryDTO equipmentErrorQueryDTO) {
        return equipmentErrorService.getEquipmentErrorList(equipmentErrorQueryDTO);
    }

    @GetMapping("/equipmentInfo/error/initGetDeviceOperationHistory/{id}")
    @ApiOperation(value = "根据设备id获取当前设备年度设备运行历史和错误分类图数据同源", notes = "2021年设备运行历史统计图和分类统计图 @author OuyangChenglong")
    public ResponseDTO initGetDeviceOperationHistory(@PathVariable String id) {
        return equipmentErrorService.getDeviceOperationHistory(id);
    }

}
